<?php
function getOrdinal($number) {
    $ends = array('th', 'st', 'nd', 'rd', 'th', 'th', 'th', 'th', 'th', 'th');
    if(($number % 100) >= 11 && ($number % 100) <= 13) {
        return $number . $ends[0];
    } else {
        return $number . $ends[$number % 10];
    }
}
?>
